package com.reading_recognition_system.service.impl;

import com.reading_recognition_system.mapper.HistoryMapper;
import com.reading_recognition_system.pojo.History;
import com.reading_recognition_system.service.HistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class HistoryServiceImpl implements HistoryService {
    @Autowired
    private HistoryMapper historyMapper;
    @Override
    public History findHistory(int u_id) {
        return historyMapper.findHistory(u_id);
    }

    @Override
    public Integer insertHistory(History history) {
        Integer flag=0;
        flag=historyMapper.insertHistory(history);
        return flag;
    }

    @Override
    public Integer deleteAllHistory(int u_id) {
        Integer flag=0;
        flag=historyMapper.deleteAllHistory(u_id);
        return flag;
    }

    @Override
    public Integer deleteOneHistory(int h_id,int u_id) {
        Integer flag=0;
        flag= historyMapper.deleteOneHistory(h_id,u_id);
        return flag;
    }

    @Override
    public Integer deleteTimeHistory(Date timestamp) {
        Integer flag=0;
        flag= historyMapper.deleteTimeHistory(timestamp);
        return flag;
    }
}
